//
//  TYZTopLeftLabel.m
//  DrivieSchoolStudents
//
//  Created by TangBin on 2019/8/1.
//  Copyright © 2019 班文政. All rights reserved.
//

#import "TYZTopLeftLabel.h"

@implementation TYZTopLeftLabel

- (instancetype)initWithFrame:(CGRect)frame
{
    return [super initWithFrame:frame];
}

/**
 初始化UILabel

 @param superView 父视图
 @param frame frame description
 @param font font
 @param block 设置属性
 @return return value description
 */
+ (TYZTopLeftLabel *)createWithLeftTopLabel:(UIView *)superView frame:(CGRect)frame font:(UIFont *)font propertiesBlock:(void(^)(TYZTopLeftLabel *label))block
{
    TYZTopLeftLabel *label = [[TYZTopLeftLabel alloc] initWithFrame:frame];
    label.font = font;
    [superView addSubview:label];
    if (block)
    {
        block(label);
    }
    return label;
}

- (CGRect)textRectForBounds:(CGRect)bounds limitedToNumberOfLines:(NSInteger)numberOfLines
{
    CGRect textRect = [super textRectForBounds:bounds limitedToNumberOfLines:numberOfLines];
    textRect.origin.y = bounds.origin.y;
    return textRect;
}

- (void)drawTextInRect:(CGRect)rect
{
    CGRect actualRect = [self textRectForBounds:rect limitedToNumberOfLines:self.numberOfLines];
    [super drawTextInRect:actualRect];
}

@end




























